<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>学生主页面</title>
    <link rel="stylesheet" type="text/css" href="../static/admin/layui2/css/layui.css"/>
    <style>
        a:hover{
            color: #00b7ee;
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header" style="background-image: linear-gradient(120deg, #131313,#4c4c4c);">
        <div class="layui-logo"><a href="yuangong-main.html" style="color: #47b3ff;font-size: 25px;">学生主页</a></div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item"><a class="layui-icon" href="guanliyuan-login.html">管理员登录</a></li>
            <li class="layui-nav-item"><a class="layui-icon layui-icon-logout" style="color: #ff3c00;font-size: 20px;text-align: center;" href="student-login.html">退出</a></li>
        </ul>
    </div>

    <div class="layui-side" style=" background-image: linear-gradient(120deg, #a7d3f2,#1E9FFF);">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree layui-bg-black"  lay-filter="test">
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-user" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i> 信息管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="student-informationChange.html" class="layui-this layui-bg-blue"><i class="layui-icon layui-icon-form" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>基本信息修改</a></dd>
                        <dd><a href=student-mimaChange.html"><i class="layui-icon layui-icon-edit" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>修改密码</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-iteme">
                    <a class="" href="student-apply.html"><i class="layui-icon layui-icon-form" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>奖学金申请</a>
                </li>
                <li class="layui-nav-item layui-nav-iteme">
                    <a class="" href="letter-box.html"><i class="layui-icon layui-icon-notice" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>通知</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body" style="background-color: #FAFAFA">
        <div class="layui-anim layui-anim-scale" style="margin-top: 50px;margin-left: 450px;">
            <div class="layui-card" style="width: 500px">
                <div class="layui-card-header">信息</div>
                <div class="layui-card-body">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th style="width: 100px">姓名</th>
                            <th style="width: 100px">性别</th>
                            <th style="width: 100px">政治面貌</th>
                            <th style="width: 100px">学号</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td id="name"></td>
                            <td id="gender"></td>
                            <td id="politic"></td>
                            <td id="number"></td>
                        </tr>
                        </tbody>
                    </table>
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th style="width: 166px">班级</th>
                            <th style="width: 166px">学院</th>
                            <th style="width: 166px">专业</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td id="clazz"></td>
                            <td id="department"></td>
                            <td id="major"></td>
                        </tr>
                        </tbody>
                    </table>
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th style="width: 250px">电话号码</th>
                            <th style="width: 250px">邮箱</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td id="phone"></td>
                            <td id="mail"></td>
                        </tr>
                        </tbody>
                    </table>
                    <table class="layui-table" lay-size="lg">
                        <thead>
                        <tr>
                            <th>获奖情况</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td id="awards"></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <button id="edit" class="layui-btn layui-btn-normal" data-type="reload">修改</button>
        </div>
    <div class="layui-footer layui-bg-black">
    </div>
</div>
<script src="../static/admin/layui2/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['element','form','jquery','layer','laydate'], function(){
        var element = layui.element
        var form = layui.form
        layer = layui.layer
            $ =layui.jquery;

        $.ajax({
            type:"POST",
            url :"/student/showInformation",
            dataType:"json",
            success:function(data){
                $("#name").html(data.name);
                if(data.gender==1){
                    $("#gender").html("男");
                }else{
                    $("#gender").html("女");
                }
                $("#politic").html(data.politic);
                $("#number").html(data.number);
                $("#clazz").html(data.clazz);
                $("#department").html(data.department);
                $("#major").html(data.major);
                $("#phone").html(data.phone);
                $("#mail").html(data.mail);
                $("#awards").html(data.awards);
            }
        })
        $(document).on('click','#edit',function (data) {
            layer.open({
                type: 2
                ,
                title: "修改信息"
                ,
                skin :'layui-layer-lan'
                ,
                area: ['600px','700px']
                ,
                id: 'LAY_layuipro' //设定一个id，防止重复弹出
                ,
                btnAlign: 'd'
                ,
                moveType: 0 //拖拽模式，0或者1
                ,
                fixed: false,
                content: "student-updatastudent.html",
                shadeClose: true,
                success: function(layero, index) {
                    var body = layer.getChildFrame('body', index);//获取iframe页的DOM
                    var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
                    body.find('#number').val($('#number').html());
                    body.find('#name').val($('#name').html());
                    body.find("input[name=gender][value=0]").attr("checked",$('#gender').html() == "女" ? true : false);
                    body.find("input[name=gender][value=1]").attr("checked",$('#gender').html() == "男" ? true : false);
                    body.find('#clazz').val($('#clazz').html());
                    body.find('#department').val($('#department').html());
                    body.find('#major').val($('#major').html());
                    body.find('#phone').val($('#phone').html());
                    body.find('#mail').val($('#mail').html());
                    body.find('#politic').val($('#politic').html());
                    body.find('#awards').val($('#awards').html());
                    iframeWin.layui.form.render();
                },
            })
        });
    });
</script>
</body>
</html>